package string;

/**
 * String trim():
 * 去除字符串两边的空白字符
 */
public class TrimDemo {
    public static void main(StringAndStringBuilderDemo[] args) {
        String str = "       hello word      ";
        String trim = str.trim();// trim()后得到的新的字符串对象并存储在trim变量中
        System.out.println(trim);// hello world
        System.out.println(str);//        hello word      ,字符串是不变对象，str内容不变

    }
}
